<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>DroidActivator</title>
<link rel="stylesheet" type="text/css" href="styles.css" />

<script language="JavaScript">

	function show(id) {
	    document.getElementById(id).style.display = 'block';
	} 

	function hide(id) {
	    document.getElementById(id).style.display = 'none';
	} 

    function toggle(id) {
        var state = document.getElementById(id).style.display;
        if ((state == 'block') | (state=="")) {
            document.getElementById(id).style.display = 'none';
        } else {
            document.getElementById(id).style.display = 'block';
        }
    } 
    
    //Generate a random activation code
    //write it in the field if empty
    //request use to confirm if not empty
    //@param the id of the element to read and write the value
    function generateCode(id){
    	
    	// check if not empty and ask user to confirm
        var element = document.getElementById(id);
        var cont = true;
		if (element.value!="") {
			if (!confirm("An activation code already exists. Overwrite?")) { 
				cont=false;
			}
		}
		
		// generate a random
		if (cont) {
			var newCode=randomCode();
		}
		
		// write the new code in the element
		if (cont) {
			element.value=newCode;
		}
    }
    
    //random code generator
    function randomCode() {
    	var chars = "0123456789";
    	var string_length = 8;
    	var randomstring = '';
    	for (var i=0; i<string_length; i++) {
    		var rnum = Math.floor(Math.random() * chars.length);
    		randomstring += chars.substring(rnum,rnum+1);
    	}
    	return randomstring;
    }

    
    // install a function to trap keys pressed
    document.onkeydown=function(e){
        if (!e) e = window.event;
        var keynum = e.keyCode ? e.keyCode : e.which; // IE vs others
		
        switch (keynum) {
        case 13: //key is enter
        
        	// if we find a "search_btn" button in the page, click it
        	var button = document.getElementById('search_btn');
        	if (button!=null) {
        		button.click();
        	    return false; //"return false" will avoid further events
			}
	    }
        
	    return; //using "return" other attached events will execute

    };


</script>

</head>


<body bgcolor="Gainsboro">
<IMG SRC="images/droidactivator_logo.png">
<hr></hr>
